using System;
using OpenRay;
using NUnit.Framework;

namespace Tests
{
	[TestFixture]
	public class TestColor
	{
		[Test]
		public void TestSet ()
		{
			Color n = new Color( 2, 3, 4, 1 );
			
			Assert.AreEqual( 1, n.Alpha );
			Assert.AreEqual( 2, n.Red );
			Assert.AreEqual( 3, n.Green );
			Assert.AreEqual( 4, n.Blue );
		}
		
		[Test]
		public void TestToArgb ()
		{
			Color n = new Color( 2, 3, 4, 1 );
			float[] arr = n.ToArgb();
			
			Assert.AreEqual( 1, arr[0] );
			Assert.AreEqual( 2, arr[1] );
			Assert.AreEqual( 3, arr[2] );
			Assert.AreEqual( 4, arr[3]);
			Assert.AreEqual( 4, arr.Length );
		}
		
		[Test]
		public void TestAdd ()
		{
			Color n = new Color( 1, 2, 3, 4 );
			Color m = new Color( 4, 3, 2, 1 );
			Color r = new Color( 5, 5, 5, 5 );
			
			Assert.AreEqual( r, n + m );
		}
		
		[Test]
		public void TestScale ()
		{
			Color n = new Color( 1, 2, 3, 4 );
			Color r = new Color( 2, 4, 6, 8 );
			
			Assert.AreEqual( r, n * 2 );
			Assert.AreEqual( r, 2 * n );
		}
		
		[Test]
		public void TestMultiply ()
		{
			Color n = new Color( 1, 2, 3, 2 );
			Color m = new Color( 2, 4, 2, 8 );
			Color r = new Color( 2, 8, 6, 16 );
			
			Assert.AreEqual( r, n * m );
		}
	}
}

